package com.lenovo.vod.player.util;

import com.lenovo.vod.player.Constant;
import com.lenovo.vod.player.Engine;

import android.os.Handler;
import android.os.Message;
import android.widget.Toast;

public class SettingHandler extends Handler {
	private Engine mEngine;

	public SettingHandler(Engine engine) {
		mEngine = engine;
	}

	@Override
	public void handleMessage(Message msg) {
		// mEngine.showToast(msg.obj.toString(), Toast.LENGTH_LONG);

		switch (msg.what) {
		case Constant.MSG_PICTURE_QUALITY:
			mEngine.setDefination(msg.obj.toString());

			break;
		case Constant.MSG_SOUND_EFFECT:
			if (msg.obj.equals(Constant.PARA_SOUND_CINEMA)) {
			} else if (msg.obj.equals(Constant.PARA_SOUND_STANDARD)) {
			} else if (msg.obj.equals(Constant.PARA_SOUND_HUMAN)) {
			} else if (msg.obj.equals(Constant.PARA_SOUND_CINEMA)) {
			}

			break;
		case Constant.MSG_SEEK_TIME:
			String[] timeArray = msg.obj.toString().split(":");
			mEngine.seekTo(Integer.parseInt(timeArray[0]) * 3600000
					+ Integer.parseInt(timeArray[1]) * 60000
					+ Integer.parseInt(timeArray[2]) * 1000);

			break;
		case Constant.MSG_BREAKPOINT_PLAY:
			if (msg.obj == Constant.PARA_SWITCH_OPEN) {
				mEngine.setBreakpointPlay(true);
			} else if (msg.obj == Constant.PARA_SWITCH_CLOSE) {
				mEngine.setBreakpointPlay(false);
			}

			break;
		case Constant.MSG_TELEPLAY_NUM:
			mEngine.setCurrentVideoNum(Integer.parseInt(msg.obj.toString()));

			break;
		case Constant.MSG_RELEVANCE:

			break;
		}
	}
}
